from langchain_openai import ChatOpenAI
from ragas.llms import LangchainLLMWrapper
from ragas.embeddings import LangchainEmbeddingsWrapper
from common.custom_model import MaasModel, MyEmbedding


def get_maas_models(base_url: str, embedding_model: str, model: str):
    """
    获取MaaS模型配置
    
    Args:
        base_url: 基础URL
        embedding_model: 嵌入模型名称
        model: 生成模型名称
    Returns:
        tuple: (llm, embeddings_wrapper)
    """
    maas_model = MaasModel(
        base_url=base_url,
        embedding_model=embedding_model
    )
    embeddings = MyEmbedding(maas_model)
    embeddings_wrapper = LangchainEmbeddingsWrapper(embeddings)
    
    llm = LangchainLLMWrapper(
        ChatOpenAI(
            base_url=base_url,
            model=model
        )
    )
    
    return llm, embeddings_wrapper 